//
//  DECXVersionViewController.m
//  DECXInStore
//
//  Created by 程强 on 15/12/25.
//  Copyright © 2015年 程强. All rights reserved.
//

#import "DECXVersionViewController.h"

@interface DECXVersionViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (strong, nonatomic) NSDictionary *versionDic;
@property (strong, nonatomic) NSArray *versionAry;
@end

@implementation DECXVersionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    self.versionTextView.text = @" 版本1.1.1 \n 1.修改更新接口 \n \n 版本1.1 \n 1.修改整体架构 \n 2.增加检查版本更新 \n \n 版本1.0.3 \n 1.加入版本号 \n 2.加入邀请好友和功能介绍 \n\n版本1.0.2 \n 1.加入用户名显示和退出登录功能 \n 2.修复登录崩溃bug \n\n版本1.0.1 \n 1.加入仓单的审核状态显示 \n\n版本1.0：\n 1.货物入仓功能 \n 2.仓库仓单列表展示";
    
    self.versionAry = @[@"版本号1.1.2",@"版本号1.1.1",@"版本号1.1",@"版本号1.0.3",@"版本号1.0.2",@"版本号1.0.1",@"版本号1.0"];
    self.versionDic = @{@"版本号1.1.2":@[@"1.增加芝麻拍照标准",@"2.增加货权人真实姓名显示",@"3.修改图片显示"],
                        @"版本号1.1.1":@[@"1.修改更新接口"],
                        @"版本号1.1":@[@"1.修改整体架构",@"2.增加检查版本更新"],
                        @"版本号1.0.3":@[@"1.加入版本号",@"2.加入邀请好友和功能介绍"],
                        @"版本号1.0.2":@[@"1.加入用户名显示和退出登录功能",@"2.修复登录崩溃bug"],
                        @"版本号1.0.1":@[@"1.加入仓单的审核状态显示"],
                        @"版本号1.0":@[@"1.货物入仓功能",@"2.仓库仓单列表展示"],

                        };

    
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.versionAry.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray *ary = [self.versionDic objectForKey:[self.versionAry objectAtIndex:section]];
    return ary.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44.0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 30.0;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(0, 0, ScreenWidth, 30)];
    view.backgroundColor = RGBColor(237, 237, 237);
    UILabel *titleLbl = [[UILabel alloc]initWithFrame:CGRectMake(20, 0, ScreenWidth-30, 30)];
    titleLbl.backgroundColor = [UIColor clearColor];
    titleLbl.font = [UIFont systemFontOfSize:16.0];
    titleLbl.textColor = RGBColor(100, 100, 100);
    titleLbl.text = [self.versionAry objectAtIndex:section];
    [view addSubview:titleLbl];
    return view;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *indentifier = @"VersionCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentifier];
    }
    NSArray *ary = [self.versionDic objectForKey:[self.versionAry objectAtIndex:indexPath.section]];
    cell.textLabel.text = ary[indexPath.row];
    cell.textLabel.textColor = RGBColor(150, 150, 150);
    cell.textLabel.font = [UIFont systemFontOfSize:15.0];
    return cell;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
